<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>方法</title>
</head>
<body>
<input type="button" value="按钮" onclick="fn()">
<script>
    function fn() {
        for (let i = 0; i < 10 ; i++) {
            alert(i)
        }
    }
    //1.无参无返回值
    function f1() {
        alert("f1");
    }
    //f1();//调用
    //2.有参无返回值
    function f2(name,age) {
        alert(name+":"+age);
    }
    //f2("张飞",18);
    //3.无参有返回值
    function f3() {
        return"我是返回值";
    }
    //let info = f3();
    //alert(info);
    //4.有参有返回值
    function f4(x,y) {
        return x*y;
    }
    let result = f4(5,9);
    //alert(result)
    //5.第二种声明方法的格式
    let f5 = function (name,age) {
        alert(name+":"+age);
    }
    //f5("张三",12);
    //6.第三种声明方法的格式
    let f6 = new Function("name","age","alert(name+':'+age)");
    //f6("赵云",20);
</script>
</body>
</html>